<admintpl file="header"/>
</head>
<body>

<div class="wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:U('index/CityGroup')}">城市列表</a></li>
        <li class="active"><a href="{:U('indexmy/addcity')}">添加城市</a></li>
    </ul>
    <form id="f_city" method="post" class="form-horizontal js-ajax-form" action="{:U('indexmy/addcity')}">
        <fieldset>
            <div class="control-group">
                <label class="control-label">城市：</label>
                <div class="controls">
                    <input type="text" id="city" name="city">
                </div>
            </div>
            <div class="control-group">
                <label class="control-label">区域：</label>
                <div class="controls">
                    <select id="dq1" name="dq1" class="form-control">
                        <option value="请选择">请选择</option>
                        <foreach name="fh" item="vo">
                            <option value="{$vo.dq}">{$vo.dq}</option>
                        </foreach>
                    </select>
                </div>
            </div>
        </fieldset>
        <div class="form-actions">
            <a href="#" id="btn_city" class="btn btn-success">确定</a>
            <a href="#" class="btn" data-dismiss="modal">取消</a>
            <span id="mess" style="color: red;"></span>
        </div>
    </form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script>
    $('#mess').hide();
    $('#btn_city').click(function () {
        var data = $('#f_city').serialize();
        $.post("{:U('Indexmy/addcity1')}", data, function (o) {
            if(o==333) {
                $('#mess').show();
                $('#mess').html('此城市已存在，请重新添加！');
                location.href = "{:U('indexmy/addcity')}";
            }else {
                if (o == 111) {
                    $('#mess').show();
                    $('#mess').html('添加成功！');
                    location.href = "{:U('indexmy/CityGroup')}";
                } else {
                    $('#mess').show();
                    $('#mess').html('添加失败！');
                    location.href = "{:U('indexmy/addcity')}";
                }
            }

        });
    });
</script>
</body>